package io.dcloud.h527baaa6.utils;

import android.content.Context;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;

/**
 * Created by hunanqi on 2017/9/7 0007.
 * 提示对话框
 */

public class AlertDialogUtils {


    //正常提示对话框
    public static void showDialog(Context context, String msg, final OnPositiveListener postiveListener) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setMessage(msg)
                .setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                        postiveListener.onNegative();
                    }
                })
                .setPositiveButton("确认", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.cancel();
                        postiveListener.onPostive();
                    }
                });
        builder.show();
    }

    public interface OnPositiveListener {
        void onPostive();
        void onNegative();
    }

}
